package java101;

import java.util.*;


public class NumLetter1 {
	

	  public static void main(String[] args)
	  {
	    int n;
	    Scanner scan = new Scanner(System.in);
	    System.out.println("Enter an integer greater than 0 and up to 1000000000: ");
	    n  = scan.nextInt();
	 
	    if(n <= 0){
	      System.out.println("Enter numbers greater than 0");
	    }
	    else
	    {
	      NumLetter1 a = new NumLetter1();
	      if (n >= 1000000000)
	    	  a.pw(((n/1000000000)%10), " billion");
	      a.pw(((n/100000000)%10)," hundred");
	      if (n >= 1000000)
	    	  a.pw(((n/1000000)%100)," million");
	      a.pw(((n/100000)%10)," hundred");
	      if (n >= 1000)
	    	  a.pw(((n/1000)%100)," thousand");
	      a.pw(((n/100)%10)," hundred");
	      a.pw((n%100)," ");
	    }
	  }
	 
	  public void pw(int n,String ch)
	  {
	    String  ones[]={" "," one"," two"," three"," four"," five"," six"," seven"," eight"," nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
	 
	    String tens[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty"," seventy"," eighty"," ninety"};
	 
	    if(n > 19) {
	     System.out.print(tens[n/10] + " " + ones[n%10]);
	    } 
	    else if (n < 19){ 
	    	System.out.print(ones[n]);
	    	}
	    
	    if(n >= 0){
	    	System.out.print(ch);
	    }
	  }
	}